home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Widget Wizard.dir / WidgtBehaviors_73_Throw.ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  905 b   |  42 lines

  1. property tracking, txvel, tyvel
  2.  
  3. on mouseDown me
  4.   set the tracking of me to 1
  5. end
  6.  
  7. on mouseWithin me
  8.   if the tracking of me then
  9.     setVelocity(me)
  10.   end if
  11. end
  12.  
  13. on mouseUpOutSide me
  14.   set the tracking of me to 0
  15.   throw(me)
  16. end
  17.  
  18. on mouseUp me
  19.   set the tracking of me to 0
  20.   throw(me)
  21. end
  22.  
  23. on throw me
  24.   set s to the spriteNum of me
  25.   set the enable of sprite(s) to 1
  26.   set the xvel of sprite(s) to the txvel of me
  27.   set the yvel of sprite(s) to the tyvel of me
  28.   puppetSprite(the spriteNum of me, 1)
  29. end
  30.  
  31. on setVelocity me
  32.   set s to the spriteNum of me
  33.   set currx to the locH of sprite s
  34.   set curry to the locV of sprite s
  35.   set the txvel of me to currx - the oldxpos of sprite(s)
  36.   set the tyvel of me to curry - the oldypos of sprite(s)
  37.   set the oldxpos of sprite(s) to currx
  38.   set the oldypos of sprite(s) to curry
  39.   set the xpos of sprite(s) to currx
  40.   set the ypos of sprite(s) to curry
  41. end
  42.